//==========================================================================
// Copyright (c) 2000-2006,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#include "util.h"

int usb_eth_init(u32 base);
int usb_eth_tx(u8 *outbuf, int size);
int usb_eth_rx(u8 *inbuf, int size);
int pxa_usb_stop( void );

extern void InitElrUser()
{
    usb_eth_init(0);
//    printf("elr_usb_open OK\n");
}

extern unsigned int ElrUDCWrite(char *pTxBuffer, unsigned int BufLen)
{
    return usb_eth_tx(pTxBuffer, BufLen);
}


extern unsigned int ElrUDCRead(char *pRxBuffer, unsigned int Bufflen)
{
    return usb_eth_rx(pRxBuffer, Bufflen);
}

//return 0 :  time out
extern unsigned int ElrUDCReadTO(char *pRxBuffer, unsigned int Bufflen, unsigned long TimeOut)
{
//  printf("set timeout %d\n",TimeOut);
    ostdelay(2500);  //wait for data transmit finish via usb bus
    return usb_eth_rx(pRxBuffer, Bufflen);
}

extern int elr_usb_close( void )
{
    return pxa_usb_stop();
}
